using System;
using System.Collections.Generic;
using System.Text;
using QLNT_DTO;
using System.Data;


namespace QLNT_DAO
{
    public class DonViTinh_dao
    {

        public DonViTinh_dto[] SelectAll()
        {
            DonViTinh_dto[] dv = new DonViTinh_dto[100];
            DataTable dt = new DataTable();
            try
            {
                dt = MyExecute.ExecuteQuery("sp_LayDSDonViTinh");
                int n = dt.Rows.Count;
                dv = new DonViTinh_dto[n];
                for (int i = 0; i < n; i++)
                {
                    dv[i] = new DonViTinh_dto();
                    dv[i].MaDonViTinh = int.Parse(dt.Rows[i]["MaDonViTinh"].ToString());
                    dv[i].TenDonViTinh = dt.Rows[i]["TenDonviTinh"].ToString();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return dv;
        }
    }
}
